<?php
	require_once ("dataBase.php");
	require_once ("addViewCount.php");
	connectDataBase("localhost", "root", "", "blueocean");
	$collegeID=@$_GET["id"];
	if(@$_GET["nav"]){
		$collegeNameArr=array();
		$collegeNameSQL="SELECT collegename FROM college";
		$collegeNameResult=mysql_query($collegeNameSQL);
		while($collegeNameRow=mysql_fetch_assoc($collegeNameResult)){
			array_push($collegeNameArr,@$collegeNameRow[collegename]);
		}
		$arr=["backmsg"=>$collegeNameArr];
	}else{
		addViewCount("college","id", $collegeID);
		$sql="SELECT * FROM college WHERE id={$collegeID}";
		$result=mysql_query($sql);
		if(mysql_num_rows($result)>0){
			$row=mysql_fetch_assoc($result);
			$arr=["backmsg"=>$row];
		}else{
			$arr=["backmsg"=>"爆炸了啊"];
		}
	}
	echo json_encode($arr);
?>